#include "overload.hpp"

using namespace learn::overloadTest;

void learn::overloadTest::overloadTest(void)
{
    // 输出整数
    print(5);
    // 输出浮点数
    print(500.263);
    // 输出字符串
    char c[] = "Hello C++";
    print(c);

    using pf = void *(*)(int &, int &);
    auto ov0 = make_shared<class learn::overloadTest::overloadTest>(1, 2); // 带上class关键字，否则识别成函数
    auto ov1 = make_shared<class learn::overloadTest::overloadTest>(3, 4); // 带上class关键字，否则识别成函数
    auto ov2 = *ov0 + *ov1;
    cout << ov2.a << " " << ov2.b << endl;
    class overloadTest ov3(5, 6), ov4(7, 8);
    auto ov5 = ov3 + ov4; // 等同于把ov5直接赋值，不存在拷贝构造
    cout << ov5.a << " " << ov5.b << endl;
    auto ov7 = ov5; // 拷贝构造ov5的对象，这里有把ov5拷贝给ov7的行为
    cout << ov7.a << " " << ov7.b << endl;
    ov7.mq.push(ov7);
    class overloadTest ov8;
    ov8 = ov7.mq.front();
    cout << "------------------" << endl;

    int arr[4096] = {1,2,3,4,5};
    learn::overloadTest::magicTest *mag = (learn::overloadTest::magicTest *)arr; //黑科技用法验证
    cout << mag->show() << endl;
}